import SwiftUI

struct AnimatableProperties_Opacity : View {

    @State var isShow = true
    
    var body: some View {
        VStack(spacing: 30) {
            Text("Animatable Properties")
                .font(.largeTitle)
            
            Text("Opacity")
                .font(.title)
            
            Text(".....")
            
            makeDemoView()
            
            Spacer()
            
            Button(action: {
                isShow.toggle()
            }, label: {
                Text(isShow ? "Hide" : "Show")
                    .font(.title)
                    .padding(.bottom, 50)
            })
        }
    }
    
    func makeDemoView() -> some View {
        ZStack {
            RoundedRectangle(cornerRadius: 12)
                .frame(width: 300, height: 150)
                .foregroundColor(.pink)
                
            Text("Dialog")
        }
        .font(.title)
        .opacity(isShow ? 1 : 0)
        .animation(.easeInOut, value: isShow)
    }
}
